home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************\
- * file: AtpOpen.c *
- * version: 1.06ß *
- * *
- * This command checks for network availability, connects us to *
- * a socket and allocates the appletalk buffers. If server requested,*
- * opens a listening socket. *
- * *
- * ----------------------------------------------------------------- *
- * By: Donald Koscheka, Greg Kimberly *
- * Date: 21-Sept-87 *
- * © Copyright 1987, Apple Computer, Inc. *
- * All Rights Reserved *
- * *
- * ----------------------------------------------------------------- *
- * Modification History *
- * ----------------------------------------------------------------- *
- * Date | By | Description *
- * ----------------------------------------------------------------- *
- * 21-Sep-87 | GK | file created *
- * 5-Nov-87 | DK | added return result *
- * | | added open as client/server/both *
- * 14-Jan-87 | DK | modified to reflect generalized control struct*
- * | | (saves address off in global container) *
- * 22-Feb-88 | DK | Move all locked handles high *
- * ----------------------------------------------------------------- *
- \*******************************************************************/
-
- /*******************************************************************\
- Build Sequence
-
- C -q2 -g -o "{hpo}"ATPOpen.c.o "{atp}"ATPOpen.c
- link -sn Main=ATPOpen -sn STDIO=ATPOpen ∂
- -sn INTENV=ATPOpen -rt XCMD=303 ∂
- -m ATPOPEN ∂
- "{hpo}"ATPOpen.c.o "{hpo}"atalkxcmd.c.o "{hpo}"xcmdutils.c.o ∂
- "{CLibraries}"CInterface.o ∂
- "{Libraries}"Interface.o ∂
- -o "{hp}"HyperPeople
-
- \*******************************************************************/
-
-
- #include <Types.h>
- #include <Memory.h>
- #include <Resources.h>
- #include <OSUtils.h>
- #include <appleTalk.h>
- #include <HyperXCmd.h>
- #include <atalkXCMD.h>
- #include <XCMDUtils.h>
-
-
- pascal void ATPOpen( paramPtr )
- XCmdBlockPtr paramPtr;
- /**********************************
- * Open up access to the network via the
- * ATP layer of appletalk. Node may be
- * CLIENT, SERVER or BOTH (neither specified)
- *
- * In:
- * params[0] char *NodeType
- *
- * Defaults : CLIENT/SERVER
- *
- * Out: Error Result is returned to hypercard
- **********************************/
- {
- ATPBlock *atp = nil;
- Handle tempH,name, zNameH,zBuffHandle;
- char s[32];
- Str31 **buffHandle;
- short error = noErr;
- short type = SERVER+CLIENT;
-
- /*** Don't reopen if atp is already allocated ***/
- atp = (ATPBlock *)RetrieveHandle( paramPtr, GLOBALATPDATA );
- if( !atp ){
- if( paramPtr->params[0] ){
- HLock( paramPtr->params[0] );
- s[0]='C';s[1]='L';s[2]='I';s[3]='E';s[4]='N';s[5]='T';s[6]='\0';
-
- if ( strCMP( s, *(paramPtr->params[0])) == 0 )
- type = CLIENT;
- else{
- s[0]='S';s[1]='E';s[2]='R';s[3]='V';s[4]='E';s[5]='R';s[6]='\0';
- if( strCMP( s, *(paramPtr->params[0])) == 0)
- type = SERVER;
- }
- HUnlock( paramPtr->params[0] );
- }
-
- atp = ATPInit( 10, type );
-
- if( atp ){
- SaveHandle( paramPtr, GLOBALATPDATA, atp );
- SaveHandle( paramPtr, GLOBALSKTDATA, atp->ServerAddr );
- }
- else
- error = DEFAULT_ERROR;
-
- }
-
- paramPtr->returnValue = ErrorReturn( error );
-
- }
-
-
-